<%@page import="cn.sendto.model.UserInfoModel"%>
<%@page import="cn.sendto.service.UserInfoService"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" errorPage="../err.jsp"%>
    <jsp:include page="../lock.jsp"></jsp:include>
<%
	request.setCharacterEncoding("UTF-8");
	String username = request.getParameter("username");
	String userpass = request.getParameter("userpass");
	String name = request.getParameter("name");
	String usertel = request.getParameter("usertel");
	
	ArrayList<Integer> errlist = new ArrayList<Integer>();
	if(userpass == null || userpass.equals("")){
		errlist.add(1);
	}
	if(name == null || name.equals("")){
		errlist.add(2);
	}
	if(usertel == null || usertel.equals("")){
		errlist.add(3);
	}
	
	if(errlist.size() > 0){
		request.setAttribute("errinfo", errlist);
		request.getRequestDispatcher("moduser.jsp").forward(request, response);
		return;
	}
	
	UserInfoModel model = new UserInfoModel();
	model.setUserPass(userpass);
	model.setName(name);
	model.setUserTel(usertel);
	model.setUserName(username);
	
	UserInfoService uis = new UserInfoService();
	int i = uis.modUser(model);
	if(i > 0 ){
		request.setAttribute("userinfo", "修改成功");
		request.getRequestDispatcher("userlist.jsp").forward(request, response);
		return;
	}else{
		request.setAttribute("userinfo", "修改失败");
		request.getRequestDispatcher("userlist.jsp").forward(request, response);
		return;
	}


%>